from appium.webdriver.mobilecommand import MobileCommand

from EGStar.head import dervier
import time
import re
import datetime
import subprocess
import os

def test():
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 道路设计
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemRoadDesign').click()
    dervier.driver.find_element_by_name('1交点法.road').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignCrossSection').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ivArrow').click()
    print(dervier.driver.contexts)
    print(dervier.driver.page_source)
    # dervier.driver.execute(MobileCommand.SWITCH_TO_CONTEXT, {"name": "WEBVIEW_com.test.jiayuan"})
    dervier.driver.execute(MobileCommand.SWITCH_TO_CONTEXT, {"name": "NATIVE_APP"})
    print(dervier.driver.current_context)
    print(dervier.driver.page_source)

test()